Repository navigation
Conversation
The expanded boundary of a KNN partition is a list of cells, and the index of these boundaries has one entry for each cell. An object that met several cells of one partition was placed in that partition once per cell. The partitioned join then returned the object as two or more of the k neighbors of a query, in place of farther neighbors. A point meets one cell unless it is on a cell edge, so this showed with lines and polygons.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes Partitioned KNN join returns the same object more than once for a query when objects are not points #3632What changes were proposed in this PR?
The partitioned KNN join (
KNNJoin) could return one object two or three times for a query, in place of farther neighbors, when the objects are lines or polygons. In the example of #3632, the query in the middle of a grid of squares got the square around it three times and no other object.ExtendedQuadTree.placeObjectputs an object of the object side into every partition whose expanded boundary it meets. The expanded boundary of a partition is a list of cells, and the index of these boundaries has one entry for each cell. An object whose envelope met several cells of one partition was found once per cell and placed in that partition as many times, so the index of the partition held copies of it and the nearest neighbor search returned them as different neighbors.placeObjectnow places an object once in each partition.The broadcast joins were not affected. A point meets one cell unless it lies exactly on a cell edge: the grid of #3632 with points as the objects returns no repeated pair.
How was this patch tested?
ExtendedQuadTreeTest(new): a square across the middle of the boundary, where the cells meet, is placed once in each partition that it belongs to. Before the change it was placed 25 times in 7 partitions.KnnJoinSuite: squares around the points of a 21 by 21 grid, in four partitions, are joined with the grid points on the partitioned plan withk = 3. With tie breakers the pairs are equal to a ranking of all pairs withRANK(). Without them the join returns three rows per query and no pair twice.Both tests fail without the change.
KnnJoinSuiteandKnnJoinQueryTestpass on Spark 3.5 with Scala 2.12 and on Spark 4.0 with Scala 2.13. The wholespark/commonmodule on Spark 3.5 passes locally except for 12 tests that need the libpostal data directory or Docker.Did this PR include necessary documentation updates?